import logging
import redis


class Config(object):
    DEBUE = False

    SECRET_KEY = 'moaFOFXOyxq4U05zxC8QJsfDi3widlEb+ZlfQYFjOHE='

    # 配置sqlalchemy
    SQLALCHEMY_DATABASE_URI = 'mysql://root:mysql@localhost/info'
    SQLALCHEMY_TRACK_MODIFICATIONS = False

    # 存储redis参数
    REDIS_HOST = 'localhost'
    REDIS_PORT = 6379

    # 配置flask-session信息(与redis关联)
    SESSION_TYPE = 'redis'
    SESSION_REDIS = redis.StrictRedis(host=REDIS_HOST, port=REDIS_PORT)
    SESSION_USE_SIGNER = True
    PERMANENT_SESSION_LIFETIME = 86400


# 开发模式
class DevelopmentConfig(Config):
    DEBUG = True
    LOG_LEVEL = logging.DEBUG


# 生产模式
class ProductionConfig(Config):
    DEBUG = False
    LOG_LEVEL = logging.ERROR
